<template>
	<view class="msg_txt">
		<block v-for="(item,index) in contentList">
			<text class="text" :key="index" v-if="item.name === 'text'">{{ item.text }}</text>
			<image class="emoji" v-else-if="item.name === 'img'" :src="item.src" mode="aspectFit" :key="index"></image>
		</block>
	</view>
</template>

<script>
	import {copy} from "@/utils/util.js"
	import {decodeText} from '@/utils/emojiMap.js'
	export default{
		props:{
			content:{
				type:String,
				required:true
			}
		},
		computed:{
			contentList() {
			  return decodeText(this.content)
			}
		},
		methods:{
			copyTxt(){
				copy(this.content)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.msg_txt{
		position: relative;
		font-size: 32rpx;
		
		
		word-wrap: break-word;
		.emoji{
			width: 1.3em;
			height: 1.3em;
			display: inline-block;
			vertical-align: text-bottom;
		}
	}
</style>
